<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:51:"D:\GitCode\LayZy/application/admin\view\ad_add.html";i:1576124263;s:49:"D:\GitCode\LayZy\application\admin\view\base.html";i:1576323868;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>LaySNS后台管理</title>
<link rel="stylesheet" href="/public/plugins/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/public/css/main.css" media="all" /> 
<link rel="stylesheet" href="/public/css/font.css">
<link rel="stylesheet" href="/public/css/admin.css">
<script src="/public/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/public/plugins/layui/layui.js"></script>
</head>

<body>

    <!--主体-->
    <div style="margin-bottom:36px;">

        
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this">新增广告</li>
    </ul>
</div>
<!--tab标签-->
<div class="layui-tab-brief">
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form form-container" action="<?php echo url('admin/ad/save'); ?>" data-url="<?php echo url('admin/ad/save'); ?>"
                  method="post" localtion-url="<?php echo url('admin/ad/index'); ?>">
                <div class="layui-row layui-col-space15 layui-form-item">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">广告位置</label>
                        <div class="layui-input-block">
                            <select lay-verify="required" name="location_id" lay-filter="location_id">
                                <?php if(is_array($category_list) || $category_list instanceof \think\Collection || $category_list instanceof \think\Paginator): $i = 0; $__LIST__ = $category_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo $vo['location_id']; ?>"><?php echo $vo['title']; ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">广告名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="请输入名称" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">链接地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="link" placeholder="请填写带http://的全路径" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">Logo</label>
                    <div class="layui-input-inline" style="width: auto;    margin-right:0px">
                        <button type="button" class="layui-btn uploadlogo"  id="banner-up-btn">
                            <i class="layui-icon"></i>上传图片
                        </button>
                        <input class="layui-upload-file" type="file" accept="undefined" name="file">
                    </div>
                    <div class="layui-input-inline" style="width: calc(100% - 234px);">
                        <input type="text" id="banner_path" name="banner_path" placeholder="建议尺寸1500*100" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-upload-list">
                        <img class="layui-upload-img" id="banner_show" style="max-height: 100px;max-width: 100%">
                    </div>
                </div>

                <div class="layui-row layui-col-space15 layui-form-item">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">联系QQ</label>
                        <div class="layui-input-block">
                            <input type="text" name="poster_qq" placeholder="请输入名称" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" id="start_time"  name="start_time" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" id="finish_time"  name="finish_time"  required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">费用</label>
                        <div class="layui-input-block">
                            <input type="number" name="money"  required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <input type="text" name="description" autocomplete="off" class="layui-input" value="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sort" autocomplete="off" class="layui-input" value="0">
                    </div>
                    <div class="label-tint">数值越大越靠前</div>
                </div>
                <div class="btable-paged">
                    <div class="formbtngroup">
                        <button class="layui-btn layui-btn-sm" lay-submit="" type="submit" lay-filter="formadd">添加
                        </button>
                        <button onclick="history.go(-1);return false;" class="layui-btn layui-btn-primary layui-btn-sm">
                            返回
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


    </div>

    

    <script>
        var token = '<?php echo $token; ?>';
    </script> 
    <!--页面JS脚本-->
    
<script type="text/javascript" src="/public/js/formadd.js"></script>
<script>
    layui.use(['form', 'upload','laydate'], function () {
        var form = layui.form,
            jq = layui.jquery;
        var upload = layui.upload;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#start_time' //指定元素
        });

        laydate.render({
            elem: '#finish_time' //指定元素
        });
        var uploadInst = upload.render({
            elem: '#banner-up-btn' //绑定元素
            , url: '<?php echo url("upload/upimage"); ?>' //上传接口
            , done: function (res) {
                layer.msg(res.msg, {
                    icon: 1,
                    time: 1000
                });
                jq("#banner_path").val(res.data.src);
                jq('#banner_show').attr('src', res.data.src);
            },
            error: function (res) {
                layer.msg(res.msg, {
                    icon: 2,
                    time: 1000
                });
            }
        });
    })
</script>

</body>

</html>